import request from '@/utils/request'
const baseUrl = '/cz-rentbox/api/v1/purchaseBoxOrders' //箱贸易管理
// import { updatePurchaseBoxOrder } from '@/api/boxDeal/boxBuy'
// 状态统计
export const boxEastStatusCount = (data: any) => {
  return request({
  url: baseUrl + '/boxEastStatusCount',
  method: 'POST',
  data: data
  // data:{
  //     "purchaseBoxNo":"HDOID2024073053645251",
  //     "carryCityId":1,
  //     "companyId":1,
  //     "buyBoxCompanyId":1,
  //     "payCurrency":"USD",
  //     "invoiceNo":"",
  //     "beginCreateDate":"2024-06-15T18:21:19",
  //     "endCreateDate":"2024-08-15T18:21:19",
  //     "beginPlanPickupDate":"2024-06-15T18:21:19",
  //     "endPlanPickupDate":"2024-08-15T18:21:19",
  //     "pageNum": 1,
  //     "pageSize": 10
  // }
  })
  }

  
export const agentStatusCount = (data: any) => {
  return request({
  url: baseUrl + '/agentStatusCount',
  method: 'POST',
  data: data
  // data:{
  //     "purchaseBoxNo":"HDOID2024073053645251",
  //     "carryCityId":1,
  //     "companyId":1,
  //     "buyBoxCompanyId":1,
  //     "payCurrency":"USD",
  //     "invoiceNo":"",
  //     "beginCreateDate":"2024-06-15T18:21:19",
  //     "endCreateDate":"2024-08-15T18:21:19",
  //     "beginPlanPickupDate":"2024-06-15T18:21:19",
  //     "endPlanPickupDate":"2024-08-15T18:21:19",
  //     "pageNum": 1,
  //     "pageSize": 10
  // }
  })
  }

// 删除订单
export const deleteOrderByIds = (data: any) => {
  return request({
  url: baseUrl,
  method: 'DELETE',
  data: data
  // data:{
  //     "purchaseBoxNo":"HDOID2024073053645251",
  //     "carryCityId":1,
  //     "companyId":1,
  //     "buyBoxCompanyId":1,
  //     "payCurrency":"USD",
  //     "invoiceNo":"",
  //     "beginCreateDate":"2024-06-15T18:21:19",
  //     "endCreateDate":"2024-08-15T18:21:19",
  //     "beginPlanPickupDate":"2024-06-15T18:21:19",
  //     "endPlanPickupDate":"2024-08-15T18:21:19",
  //     "pageNum": 1,
  //     "pageSize": 10
  // }
  })
  }

/*
# 售箱公司购箱管理订单分页列表
# POST {{baseUrl}}/purchaseBoxOrders/getSellPurchaseBoxOrderPage
# 过滤条件：回调订单号:String orderNo 创建时间时间区间:beginCreateDate endCreateDate
# 预计提箱日期  LocalDateTime beginPlanPickupDate  LocalDateTime endPlanPickupDate
# 出发城市Id: carryCityId 到达城市Ids: List<Long> returnCityIds
# 订单状态 5-待开提箱单 10-待提 15-已提 20-待还 25-已还未付/已还已付 30-已完成 35-已取消
*/
export const getSellPurchaseBoxOrderPage = (data: any) => {
return request({
url: baseUrl+'/getSellPurchaseBoxOrderPage',
method: 'POST',
data: data
// data:{
//     "purchaseBoxNo":"HDOID2024073053645251",
//     "carryCityId":1,
//     "companyId":1,
//     "buyBoxCompanyId":1,
//     "payCurrency":"USD",
//     "invoiceNo":"",
//     "beginCreateDate":"2024-06-15T18:21:19",
//     "endCreateDate":"2024-08-15T18:21:19",
//     "beginPlanPickupDate":"2024-06-15T18:21:19",
//     "endPlanPickupDate":"2024-08-15T18:21:19",
//     "pageNum": 1,
//     "pageSize": 10
// }
})
}

export const boxEastPackingListPage = (data: any) => {
  return request({
    url: baseUrl+'/boxEastPackingListPage',
    method: 'POST',
    data: data
    // data:{
    //     "purchaseBoxNo":"HDOID2024073053645251",
    //     "carryCityId":1,
    //     "companyId":1,
    //     "buyBoxCompanyId":1,
    //     "payCurrency":"USD",
    //     "invoiceNo":"",
    //     "beginCreateDate":"2024-06-15T18:21:19",
    //     "endCreateDate":"2024-08-15T18:21:19",
    //     "beginPlanPickupDate":"2024-06-15T18:21:19",
    //     "endPlanPickupDate":"2024-08-15T18:21:19",
    //     "pageNum": 1,
    //     "pageSize": 10
    // }
    })
  }

/*
# 买箱公司购箱管理订单分页列表
# POST {{baseUrl}}/purchaseBoxOrders/getBuyPurchaseBoxOrderPage
# 过滤条件：回调订单号:String orderNo 创建时间时间区间:beginCreateDate endCreateDate
# 预计提箱日期  LocalDateTime beginPlanPickupDate  LocalDateTime endPlanPickupDate
# 出发城市Id: carryCityId 到达城市Ids: List<Long> returnCityIds
# 订单状态 5-待开提箱单 10-待提 15-已提 20-待还 25-已还未付/已还已付 30-已完成 35-已取消
*/
export const getBuyPurchaseBoxOrderPage = (data: any) => {
return request({
url: baseUrl+'/getBuyPurchaseBoxOrderPage',
method: 'post',
data: data
// data:{
//     "purchaseBoxNo":"HDOID2024073053645251",
//     "carryCityId":1,
//     "companyId":1, //售箱公司Id
//     "buyBoxCompanyId":1, // 买箱公司Id
//     "payCurrency":"USD",
//     "invoiceNo":"",
//     "beginCreateDate":"2024-06-15T18:21:19",
//     "endCreateDate":"2024-08-15T18:21:19",
//     "beginPlanPickupDate":"2024-06-15T18:21:19",
//     "endPlanPickupDate":"2024-08-15T18:21:19",
//     "pageNum": 1,
//     "pageSize": 10
// }
})
}

/*
### 买箱公司新增购箱订单
# POST {{baseUrl}}/purchaseBoxOrders/addPurchaseBoxOrder
*/
export const addPurchaseBoxOrder = (data: any) => {
return request({
url: baseUrl+'/addPurchaseBoxOrder',
method: 'POST',
data: data
// data:{
//     "releaseSaleId": 1,
//     "unitPrice": 100,
//     "boxType": 5,
//     "boxCondition": 5,
//     "payCurrency": "USD",
//     "boxQuantity": 10,
//     "planPickupDate": "2024-06-15T18:21:19",
//     "paymentMethod": 5,
//     "invoiceType": 5,
//     "contacts": "张三",
//     "tel": "1234567890",
//     "leaveMsg": "留言",
//     "couponAmount": 0,
//     "allocation": "[{\"operateUserId\": 1,\"businessUserId\": 2,\"businessNo\": \"NO1234567890\",\"handleUserId\": 3}]"
  // }


})
}

/*
# 根据订单id获取购箱订单详情
# GET {{baseUrl}}/purchaseBoxOrders/{id}
*/
export const getOrderInfo = (id: any) => {
return request({
url: baseUrl+'/'+id,
method: 'GET'
})
}

/*
### 购箱订单确认
## PUT  {{baseUrl}}/purchaseBoxOrders/notarizePurchaseBoxOrder
*/
export const notarizePurchaseBoxOrder = (data: any) => {
return request({
url: baseUrl+'/notarizePurchaseBoxOrder',
method: 'PUT',
data: data
// data:{
//      "id": 10,
//      "unitPrice": 100,
//      "targetCurrency": "USD",
//      "containerNo": ["HUNU5118021","HUNU5118022","HUnu5118023"],
//      "rate": 6.5
// }
})
}

/*
### 取消购箱订单
## PUT  {{baseUrl}}/purchaseBoxOrders/cancelPurchaseBoxOrderById
*/
export const cancelPurchaseBoxOrderById = (data: any) => {
return request({
url: baseUrl+'/cancelPurchaseBoxOrderById',
method: 'PUT',
data: data
// data:{
//     "id": 10,
//     "remark": "备注取消原因"
// }
})
}

/*
### 购箱订单申请退款
## PUT  {{baseUrl}}/purchaseBoxOrders/applyRefundPurchaseBoxOrderById
*/
export const applyRefundPurchaseBoxOrderById = (data: any) => {
return request({
url: baseUrl+'/applyRefundPurchaseBoxOrderById',
method: 'PUT',
data: data
// data:{
//   "purchaseBoxOrder": "[{\"id\": 5,\"refundQuantity\": 1},{\"id\": 6,\"refundQuantity\": 1}]",
//   "couponAmount": 0, // 优惠券
//   "remark": "备注退款原因"
// }
})
}

/*
### 购箱订单退款
## PUT  {{baseUrl}}/purchaseBoxOrders/refundPurchaseBoxOrderById
*/
export const refundPurchaseBoxOrderById = (data: any) => {
return request({
url: baseUrl+'/refundPurchaseBoxOrderById',
method: 'PUT',
data: data
// data:{
//   "invoiceId":1814240791595909166,
//   "paymentMethod": 5,
//   "refundPayUrl":"[{\"name\":\"20240612/cddd81a833c64a7eab1da5c0aef8dfaf.docx\",\"returnReceiptFileName\":\"国际贸易供应链数字平台电子回执单.docx\",\"url\":\"http://47.122.3.254:9000/default/20240612/cddd81a833c64a7eab1da5c0aef8dfaf.docx\"}]",
//   "refundPickupDate": "2024-09-04T18:21:19",
//   "remark": "备注退款和拒绝退款原因"
// }
})
}

/*
### 重开发票 售箱管理订单款项明细
## POST {{baseUrl}}/purchaseBoxOrders/boxListDetail
*/
export const boxListDetail = (data: any) => {
return request({
url: baseUrl+'/boxListDetail',
method: 'POST',
data: data
// data:{
//   "purchaseIds": [1,2]
// }
})
}

/*
### 修改购箱订单
## PUT  {{baseUrl}}/purchaseBoxOrders/updatePurchaseBoxOrder
*/
export const updatePurchaseBoxOrder = (data: any) => {
return request({
url: baseUrl+'/updatePurchaseBoxOrder',
method: 'PUT',
data: data
// data:{
//   "id": 2,
//   "unitPrice": 100,
//   "targetCurrency": "USD",
//   "containerNo": "HUNU5453    021,HUNU511802****2,HUnu5118023,HUNU5118024,HUNU5118025",
//   "rate": 6.5,
//   "boxEastOperatorUserId": 1,
//   "boxEastOperatorUserName": "集装箱公司操作员名称",
//   "boxEastOperatorUserAreaCode": "86",
//   "boxEastOperatorUserTel": "1234567890"
// }
})
}
//货代购箱导出 exportAgentPurchaseBoxOrder
// data:{
//   "purchaseIds": [1,2]
// }
export const exportAgentPurchaseBoxOrder = (orderIds: any) => {
return request({
  responseType: 'blob',
  url: baseUrl+'/exportAgentPurchaseBoxOrder',
  method: 'POST',
  data: orderIds

  })
}

//货代购箱导出 exportAgentPurchaseBoxOrder
// data:{
//   "purchaseIds": [1,2]
// }
export const exportBoxPurchaseBoxOrder = (orderIds: any) => {
  return request({
    responseType: 'blob',
    url: baseUrl+'/exportBoxPurchaseBoxOrder',
    method: 'POST',
    data: orderIds
    
    })
  }

